package com.baoyouqun.service;

import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baoyouqun.domain.CreateCmd.UserVipTimeCreateCmd;
import com.baoyouqun.domain.Query.UserVipTimeQuery;
import com.baoyouqun.domain.UpdateCmd.UserVipTimeUpdateCmd;
import com.baoyouqun.domain.VO.UserVipTimeVO;
import com.baoyouqun.entity.UserVipTime;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Set;


public interface UserVipTimeService extends IService<UserVipTime> {
    Map<String, Boolean> getValidVipMap(List<String> userIds, LocalDateTime now);

    /**
     * 创建临时会员
     */
    SingleResponse<UserVipTime> createTemp(String userId);

    /**
     * 新增并返回实体
     */
    SingleResponse<UserVipTimeVO> create(UserVipTimeCreateCmd cmd);

    Response update(UserVipTimeUpdateCmd cmd);

    /**
     * 根据ID查询VO
     */
    UserVipTimeVO selectById(String id);

    /**
     * 分页查询VO
     */
    IPage<UserVipTimeVO> pageVo(UserVipTimeQuery query);

    UserVipTimeVO selectByUserId(String userId);

    Map<String, Boolean> getVipStatusByUserIds(List<String> userIds);

    /**
     * 查询用户当前有效的会员记录（未过期）
     */
    UserVipTimeVO getCurrentVip(String userId);

    /**
     * 根据用户ID列表+会员等级，筛选有效会员用户ID
     */
    List<String> getEffectiveVipUserIdList(List<String> userIdList, String memberLevel);

    void createBaoZhiHao(String userId);

    Set<String> selectValidVipUserIds(List<String> candidateIds);

    boolean checkByUserId(String userId);
}